<?php

Yii::import('zii.widgets.CMenu');
Yii::import('application.modules.admin.models.Menu');

/**
 * Description of MainMenu
 *
 * @author HEO
 */
class MainMenu extends CWidget {
    
    public $visible = true;
    
    public function run() {
        $list = Menu::model()->findAll('menu_type_id = :menu_type_id && parent_id is null', array(':menu_type_id' => 1));
        $items = array();
        foreach ($list as $item) {
            $items[] = $item->getList();
        }
        
        $this->render('MainMenu', array('items' => $items, 'visible' => $this->visible));
    }
    
}
